﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="ListCustomers.aspx.cs" Inherits="ListUsers" %>

<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var template = '<span style="color:{0};">{1}</span>';

        var change = function (value) {
            return String.format(template, (value > 0) ? "green" : "red", value);
        }

        var pctChange = function (value) {
            return String.format(template, (value > 0) ? "green" : "red", value + "%");
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <ext:Store ID="Store1" runat="server" OnRefreshData="Store1_RefreshData">
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="clientId" />
                    <ext:RecordField Name="name" />
                    <ext:RecordField Name="surName" />
                    <ext:RecordField Name="tcNo" />
                    <ext:RecordField Name="createDate" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" Title="Customer List"
        Width="790" Height="320">
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column Header="Customer ID" DataIndex="clientId" />
                <ext:Column ColumnID="CustomerName" Header="Customer Name" DataIndex="name" />
                <ext:Column Header="Customer Surname" DataIndex="surName" />
                <ext:Column Header="Customer Citizenship Nu." DataIndex="tcNo" />
                <ext:Column Header="Customer Create Date" DataIndex="createDate" />
                <ext:CommandColumn Width="55">
                    <Commands>
                        <ext:GridCommand Icon="NoteEdit" CommandName="Edit">
                            <ToolTip Text="Edit" />
                        </ext:GridCommand>
                        <ext:CommandSeparator />
                        <ext:GridCommand Icon="Delete" CommandName="Delete">
                            <ToolTip Text="Delete" />
                        </ext:GridCommand>
                    </Commands>
                </ext:CommandColumn>                
            </Columns>            
        </ColumnModel>
        <Listeners>
            <Command Handler="Ext.net.DirectMethods.viewClient(command, record.data.clientId);" />
        </Listeners>
        <TopBar>
            <ext:Toolbar ID="Toolbar1" runat="server">
                <Items>
                    <ext:Button ID="Button1" runat="server" Text="Add" Icon="Add">
                        <Listeners>
                    <Click Handler="Ext.Msg.alert('Confirm', 'You Clicked Add');" />
                </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button2" runat="server" Text="Delete" Icon="Exclamation">
                        <Listeners>
                            <Click Handler="Ext.Msg.confirm('Delete Agent', 'Are you sure?');" />
                            <%-- çalışmazzz --%>
                            <%--Ext.Msg.alert('Click','Click on Delete');  --%>
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button3" runat="server" Text="View" Icon="User">
                        <Listeners>
                    <Click Handler="Ext.Msg.alert('Confirm', 'You Clicked View');" />
                </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button4" runat="server" Text="Edit" Icon="Pencil">
                        <Listeners>
                    <Click Handler="Ext.Msg.alert('Confirm', 'You Clicked Edit');" />
                </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
        </SelectionModel>
        <LoadMask ShowMask="true" />
        <BottomBar>
            <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="10" StoreID="Store1" />
        </BottomBar>        
    </ext:GridPanel>
    <ext:Label ID="idshower" runat="server"></ext:Label>
</asp:Content>
